package Lee_code;

/**
 * @author blh
 * @date 2024年07月05日 16:42
 */
public class Lee_11_75 {
    public int maxArea(int[] height) {
        int len = height.length;
        int left = 0;
        int right = len - 1;
        int maxArea = 0;
        while (left < right) {
            int tempArea = Math.min(height[right], height[left]) * (right - left + 1);
            maxArea = Math.max(tempArea, maxArea);
            if (height[right] > height[left]) {
                left--;
            } else if (height[right] < height[left]) {
                right++;
            } else {
                left--;
            }
        }
        return maxArea;
    }
}
